{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Regressão Linear Multivariada - Trabalho\n",
    "\n",
    "## Estudo de caso: Qualidade de Vinhos\n",
    "\n",
    "Nesta trabalho, treinaremos um modelo de regressão linear usando descendência de gradiente estocástico no conjunto de dados da Qualidade do Vinho. O exemplo pressupõe que uma cópia CSV do conjunto de dados está no diretório de trabalho atual com o nome do arquivo *winequality-white.csv*.\n",
    "\n",
    "O conjunto de dados de qualidade do vinho envolve a previsão da qualidade dos vinhos brancos em uma escala, com medidas químicas de cada vinho. É um problema de classificação multiclasse, mas também pode ser enquadrado como um problema de regressão. O número de observações para cada classe não é equilibrado. Existem 4.898 observações com 11 variáveis de entrada e 1 variável de saída. Os nomes das variáveis são os seguintes:\n",
    "\n",
    "1. Fixed acidity.\n",
    "2. Volatile acidity.\n",
    "3. Citric acid.\n",
    "4. Residual sugar.\n",
    "5. Chlorides.\n",
    "6. Free sulfur dioxide. \n",
    "7. Total sulfur dioxide. \n",
    "8. Density.\n",
    "9. pH.\n",
    "10. Sulphates.\n",
    "11. Alcohol.\n",
    "12. Quality (score between 0 and 10).\n",
    "\n",
    "O desempenho de referencia de predição do valor médio é um RMSE de aproximadamente 0.148 pontos de qualidade.\n",
    "\n",
    "Utilize o exemplo apresentado no tutorial e altere-o de forma a carregar os dados e analisar a acurácia de sua solução. \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Aluno: Marcos Felipe de Menezes Mota -354080"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 0.03387099  0.00120558  0.0013778  ...,  0.00223893  0.05453803\n",
      "   0.02870423]\n",
      " [ 0.06434697  0.00255837  0.00333364 ...,  0.00364374  0.07209961\n",
      "   0.03876323]\n",
      " [ 0.03719477  0.00091839  0.00225005 ...,  0.0021123   0.04591947\n",
      "   0.03214363]\n",
      " ..., \n",
      " [ 0.07470573  0.00245462  0.00277478 ...,  0.00586974  0.10138635\n",
      "   0.06403348]\n",
      " [ 0.05133141  0.00150572  0.00225858 ...,  0.00465405  0.07802374\n",
      "   0.04106513]\n",
      " [ 0.0866237   0.00210372  0.00457868 ...,  0.00569241  0.13364799\n",
      "   0.0866237 ]]\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from sklearn.model_selection import train_test_split \n",
    "from sklearn.preprocessing import normalize\n",
    "from math import sqrt\n",
    "\n",
    "\n",
    "def predict(row, coefficients):    \n",
    "    yhat = coefficients[0]\n",
    "    for i in range(len(row)-1):\n",
    "        yhat += coefficients[i + 1] * row[i]\n",
    "    return yhat\n",
    "\n",
    "\n",
    "def coefficients_sgd(train, l_rate, n_epoch):\n",
    "    coef = [0.0 for i in range(len(train[0]))]\n",
    "    print ('Coeficiente Inicial={0}' % (coef))\n",
    "    for epoch in range(n_epoch):\n",
    "        sum_error = 0\n",
    "        for row in train:\n",
    "            yhat = predict(row, coef)\n",
    "            error = yhat - row[-1]\n",
    "            sum_error += error**2\n",
    "            coef[0] = coef[0] - l_rate * error\n",
    "            for i in range(len(row)-1):\n",
    "                coef[i + 1] = coef[i + 1] - l_rate * error * row[i] \n",
    "        print(('epoch=%d, lrate=%.3f, error=%.3f' % (epoch, l_rate, sum_error)))\n",
    "    return coef\n",
    "\n",
    "\n",
    "def rmse_metric(actual, predicted):\n",
    "  sum_error = 0.0\n",
    "  for i in range(len(actual)):\n",
    "    prediction_error = predicted[i] - actual[i]\n",
    "    sum_error += (prediction_error ** 2)\n",
    "  mean_error = sum_error / float(len(actual))\n",
    "  return sqrt(mean_error)\n",
    "\n",
    "dataset = pd.read_csv(\"winequality-white.csv\", delimiter=\";\")\n",
    "dataset = dataset.iloc[:,:].values\n",
    "dataset = normalize(dataset)\n",
    "data_train, data_test = train_test_split(dataset, test_size=0.2)\n",
    "\n",
    "print(data_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Coeficiente Inicial={0}\n",
      "epoch=0, lrate=0.010, error=1.407\n",
      "epoch=1, lrate=0.010, error=1.177\n",
      "epoch=2, lrate=0.010, error=1.028\n",
      "epoch=3, lrate=0.010, error=0.902\n",
      "epoch=4, lrate=0.010, error=0.796\n",
      "epoch=5, lrate=0.010, error=0.706\n",
      "epoch=6, lrate=0.010, error=0.630\n",
      "epoch=7, lrate=0.010, error=0.566\n",
      "epoch=8, lrate=0.010, error=0.512\n",
      "epoch=9, lrate=0.010, error=0.466\n",
      "epoch=10, lrate=0.010, error=0.427\n",
      "epoch=11, lrate=0.010, error=0.395\n",
      "epoch=12, lrate=0.010, error=0.367\n",
      "epoch=13, lrate=0.010, error=0.344\n",
      "epoch=14, lrate=0.010, error=0.324\n",
      "epoch=15, lrate=0.010, error=0.307\n",
      "epoch=16, lrate=0.010, error=0.293\n",
      "epoch=17, lrate=0.010, error=0.281\n",
      "epoch=18, lrate=0.010, error=0.271\n",
      "epoch=19, lrate=0.010, error=0.262\n",
      "epoch=20, lrate=0.010, error=0.255\n",
      "epoch=21, lrate=0.010, error=0.249\n",
      "epoch=22, lrate=0.010, error=0.244\n",
      "epoch=23, lrate=0.010, error=0.239\n",
      "epoch=24, lrate=0.010, error=0.236\n",
      "epoch=25, lrate=0.010, error=0.233\n",
      "epoch=26, lrate=0.010, error=0.230\n",
      "epoch=27, lrate=0.010, error=0.228\n",
      "epoch=28, lrate=0.010, error=0.226\n",
      "epoch=29, lrate=0.010, error=0.224\n",
      "[0.03760607750116276, 0.1507632278174687, 0.005018775442803981, 0.006873238810422973, 0.0033876388768122124, 0.0006188109318230216, 0.005774536397803937, -0.030287353178850774, 0.0237539269197695, 0.07738794303691893, 0.01118116568308193, 0.3036540571684595]\n"
     ]
    }
   ],
   "source": [
    "l_rate = 0.01\n",
    "n_epoch = 30\n",
    "\n",
    "coef = coefficients_sgd(data_train.tolist(), l_rate, n_epoch)\n",
    "print(coef)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def test_predict(dataset, coefficients):\n",
    "    y_pred = []\n",
    "    for row in dataset:\n",
    "        y_pred += [predict(row, coefficients)]\n",
    "    return y_pred"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.050871531415869503, 0.030857179981893121, 0.062964789343552319, 0.030520093107617958, 0.027404513593404466, 0.060804853354153143, 0.046397826677712112, 0.050145472321706713, 0.074604473565915666, 0.061633889372975065, 0.035989847897245984, 0.05301212325018112, 0.043416220253610083, 0.071062491156764607, 0.04727507143335867, 0.057244647982916202, 0.051296165624744372, 0.076503238482190206, 0.050361654906679251, 0.047280874510256296, 0.044561342241359943, 0.027035958957764436, 0.029073834283720248, 0.034521174971068616, 0.034560360504433368, 0.028701360406641518, 0.066112631778924791, 0.041981546710690952, 0.058614394987136276, 0.040429631830565804, 0.040721547285493556, 0.027725854721566419, 0.043437680801333589, 0.052153772269223728, 0.040737793291901331, 0.04441897890026536, 0.032179416813290257, 0.05315466427567684, 0.028076005689954171, 0.035624170614166305, 0.056610694574571088, 0.067005977541398296, 0.073314375255596864, 0.036739711912576689, 0.070439672629330652, 0.044323274848472892, 0.04623764429370647, 0.032286249789329313, 0.047606184840208898, 0.043528698975369914, 0.05151926496099099, 0.045422433230261045, 0.0630070749369461, 0.03660700720541557, 0.054111963735733348, 0.045751717455887908, 0.047709854347311398, 0.048504434979766968, 0.032234249455314203, 0.051039656397552605, 0.050640413479100033, 0.054786035361669538, 0.050726194266000238, 0.028933582098460923, 0.080504444765927802, 0.040957688825833866, 0.035682167870390157, 0.047029826773997918, 0.036915038151842917, 0.038914051783862084, 0.063976131673585637, 0.033433406166322073, 0.045336802535068749, 0.05843095620926203, 0.046819748595512356, 0.074751864555072975, 0.03986922128821644, 0.055833720014392518, 0.03023740426428918, 0.030682476521028068, 0.083127971448020435, 0.052109574259434646, 0.037012644230934047, 0.039408441212296176, 0.18895696794442016, 0.025520644336549367, 0.041040044953928267, 0.041326447418264786, 0.034711367238581897, 0.029222081907753494, 0.052213546565653378, 0.044665967467973113, 0.044385982341121871, 0.042685161010194123, 0.074403654985241985, 0.032802412399507222, 0.03054917186068775, 0.040713626367546517, 0.026474763477705509, 0.034859613125981792, 0.050344435490315032, 0.035664716973136716, 0.035087259271299777, 0.037493691698918093, 0.04553670752275104, 0.042699785977885631, 0.039108808555932024, 0.04343692893545073, 0.045707334157493562, 0.035630387425357526, 0.031663012345841894, 0.03615825330876167, 0.069813541044559807, 0.042661964045799278, 0.040016030486916279, 0.034074949230690543, 0.053190490982264256, 0.03395926948794567, 0.048347133760045402, 0.068449348476776639, 0.033614188945058965, 0.055243961816395383, 0.04540031601803636, 0.039571341553807426, 0.047508231971174431, 0.048330539445586032, 0.054956726093794872, 0.056085440372827824, 0.039393447430378245, 0.042536099241899952, 0.036994401740886543, 0.057094305854195039, 0.041260197273421631, 0.034775171841585337, 0.038985435506833518, 0.034573440872907139, 0.043596516205172922, 0.055096661651805351, 0.21126844896799121, 0.054969506626200391, 0.045301523472664557, 0.074296507508269993, 0.049382223273798473, 0.03998589894876764, 0.056635011615596975, 0.035925139802096502, 0.037380914275917894, 0.067203783641227546, 0.056735155646541857, 0.048589559291997389, 0.044688590044436066, 0.031913230078973585, 0.041315257151670615, 0.063578836386793722, 0.045765987180173981, 0.052109574259434646, 0.072578307128309413, 0.044269915109332564, 0.064807337801407808, 0.044010444549610984, 0.039843022963750016, 0.054753357365484506, 0.029548467090415496, 0.030159360780952209, 0.034521563884631908, 0.033642794457445807, 0.052753320717361295, 0.038591978762614443, 0.073525177180401316, 0.033268008461685261, 0.047189987857834785, 0.041882496699520738, 0.029459764876268592, 0.032395678187977402, 0.058367914161178994, 0.037024348331501408, 0.036024628030926278, 0.027890047352418259, 0.079095766755183095, 0.054103043365639175, 0.05141967529281144, 0.051506406090357539, 0.048913902479377179, 0.057862393988206723, 0.030074621399777995, 0.036333536436872718, 0.044323068233041274, 0.066815348954442411, 0.051795135046828936, 0.032076895991743848, 0.048503616348899811, 0.03440128393198353, 0.042827745397773842, 0.045444339517532767, 0.049112510927370831, 0.048944357471687905, 0.04217243316048197, 0.037283716524239507, 0.039122391343050136, 0.037675884847699306, 0.086004895117892277, 0.05327214605324769, 0.062810948906188213, 0.028486239996192309, 0.10191667445083767, 0.087573774157635106, 0.044888035278483757, 0.028390083403535826, 0.092414319300089476, 0.042460210034963766, 0.045841061177638122, 0.044194887683071796, 0.049980251965818415, 0.056191514587075678, 0.049352953622520374, 0.033275727886153739, 0.044688972638602484, 0.044344713797815107, 0.040062125654698945, 0.029635026367515541, 0.032733854187788708, 0.048185773463033127, 0.047698016784047191, 0.035373328753301861, 0.041704644132075766, 0.046398977807789135, 0.054075965303928719, 0.05116826531877041, 0.047875161713518383, 0.040379299514947758, 0.037022594828153108, 0.039876145202230068, 0.033821989032978034, 0.033441516160217989, 0.043966107713252198, 0.042865613541628891, 0.067133807699068571, 0.044916802195090658, 0.032085916793701763, 0.034551237847564725, 0.054850612371347487, 0.039715322607033594, 0.04774127298263614, 0.049845282398262497, 0.026884846575995124, 0.045490745515445991, 0.04964103805960756, 0.03723303463227183, 0.030729964719221389, 0.050753797088728819, 0.065385780351603529, 0.061098058071376291, 0.070625504057594435, 0.035974271078065875, 0.037690808129948933, 0.035572277099892594, 0.033238236066407703, 0.035007997515395323, 0.057373474747713635, 0.031923110111787376, 0.031097464738565249, 0.03933641878725018, 0.034531867086630211, 0.040544178344758638, 0.049147029262766831, 0.03635413217207735, 0.024833140532564073, 0.046536930393811834, 0.053269510581775849, 0.063730700128397738, 0.044538989083456715, 0.037978980679370736, 0.040865225523164406, 0.044670361884556628, 0.049228591220258418, 0.042693654231798848, 0.035664716973136716, 0.033337752582650551, 0.052676941787608123, 0.067050611429907592, 0.030027797073647455, 0.037963579596428029, 0.05769106338077571, 0.042012466720450226, 0.04657977372547404, 0.034154817733149968, 0.035571818402432925, 0.041619963414799788, 0.060096380986376763, 0.026915985686189935, 0.048533448753174099, 0.051352108005435215, 0.050591953140123914, 0.027854812102912026, 0.054957466063262857, 0.049304621095714395, 0.043783388527658673, 0.046020082445455912, 0.03824351658155857, 0.059582077085421598, 0.04572442986671859, 0.032652440432582613, 0.031833273396453379, 0.037693291442573315, 0.035218850511939959, 0.032179416813290257, 0.038790441047769311, 0.061633889372975065, 0.048125519332560998, 0.099193597986224111, 0.034123631151612627, 0.040399470666059596, 0.069675406755162095, 0.040957688825833866, 0.085225078503628537, 0.034012496192789475, 0.076794653315074499, 0.034598177511256961, 0.030003997233866674, 0.034875687297202362, 0.026893208636049916, 0.037858596165988898, 0.04478804382265316, 0.032526423243208667, 0.053743827038454865, 0.06108310897188747, 0.049343621705867827, 0.044281125692099584, 0.068507779137437816, 0.059475666297249263, 0.038503070392914771, 0.047225621204864086, 0.094633772450415557, 0.026712067887707261, 0.035182227106868871, 0.046716196783065878, 0.065340887050401614, 0.043477545116184138, 0.033169890729372105, 0.060890033044728245, 0.035131033384520421, 0.038532791969083879, 0.046424447787069126, 0.029899535313780826, 0.037980223319886014, 0.049999540314265095, 0.047468514180780061, 0.038419586895967035, 0.052349586634711925, 0.062322466350463193, 0.074233372746445522, 0.025836011001278459, 0.031698677765232101, 0.048557145374173959, 0.047381132107523954, 0.046793717197948011, 0.037539162545582878, 0.027237395049458171, 0.03847864265640346, 0.05085590632950078, 0.053702244894966819, 0.043437680801333589, 0.031064820590689657, 0.040467072395960021, 0.045301523472664557, 0.054852610032172275, 0.050804892734692478, 0.03627605412499614, 0.043071181791225537, 0.054870143619573986, 0.072226827022765658, 0.036292583551148727, 0.046687081248611068, 0.03099586164509413, 0.045671407346426177, 0.049428936397870979, 0.037962668670906773, 0.052575118750018274, 0.026783679891231444, 0.034740491374934609, 0.036657368734928857, 0.055535460822227045, 0.048694842088385371, 0.041282821518417438, 0.036008184827208849, 0.036514703128942123, 0.025969641794195801, 0.035253028383728895, 0.030921746685953724, 0.042683859603495425, 0.06037727589176816, 0.043002314315203863, 0.034797508817150921, 0.027774087660093323, 0.055421916000872332, 0.052221829579436309, 0.04027155686718023, 0.052213546565653378, 0.062054001596055779, 0.053547280759213695, 0.04798201984713564, 0.03460865540838326, 0.03529407951967431, 0.042493335141081598, 0.075286626233529733, 0.07096236274464332, 0.040378926668995146, 0.036983372022025826, 0.053574354681101125, 0.050871955343476764, 0.059801132918505862, 0.044870882447621573, 0.076470145566312459, 0.056112233050796073, 0.034775171841585337, 0.033400101769412098, 0.067008598555941351, 0.033353932804509559, 0.029863215415353337, 0.048503616348899811, 0.04641167230161785, 0.068682261146649937, 0.05177158441402166, 0.058418910360641882, 0.049999540314265095, 0.024860963983583236, 0.042530680093218157, 0.032299199123920035, 0.029145688510741424, 0.063833762111790385, 0.044562225805731624, 0.057316906976190921, 0.039686759484841495, 0.05160875328442064, 0.041092035122210005, 0.061723533890380711, 0.049275974620902566, 0.032111306969046051, 0.034164218957588068, 0.038061464321145613, 0.044932525134367227, 0.048180190209863347, 0.056373644468343448, 0.03712048644464986, 0.087303344150377854, 0.028402958439973418, 0.04808492057379686, 0.042496924922814143, 0.046435908016662884, 0.035381771493964799, 0.072116730568727611, 0.04999874792146114, 0.052026103706106393, 0.036001017829925652, 0.03517892469139107, 0.037143976431639823, 0.033933041722127501, 0.031585392892345847, 0.073524696607240092, 0.041855969568737647, 0.048313356821435345, 0.056621699705437241, 0.029970177984870106, 0.052089616708810516, 0.037614947172787849, 0.045643840601919193, 0.036487834271398872, 0.056364508741353236, 0.02971828976069895, 0.03708201902230867, 0.033628253133420737, 0.042217136068149391, 0.049877461829109598, 0.036167342839025729, 0.079750582801377048, 0.062841583601310008, 0.042622517616055261, 0.061419922823340745, 0.065165721104892035, 0.065531298925442918, 0.030647052289415666, 0.037720911491494521, 0.074987798312915688, 0.026554383885826423, 0.042106901597431884, 0.052074933603712917, 0.035989847897245984, 0.057904007035485067, 0.04788011212618374, 0.034021878857693109, 0.039386978945514628, 0.055624620123013571, 0.10084358162464471, 0.05828137388028784, 0.04153799349113399, 0.032782962264812233, 0.03806469245632281, 0.027138871782906061, 0.05367884422481814, 0.044081143167947215, 0.049806071273692964, 0.025761314598229303, 0.036381934721243528, 0.030598213312660563, 0.030684758996152646, 0.037357954231532223, 0.025096787455155888, 0.036427337627242928, 0.031402022420821414, 0.049416820857353494, 0.03260670362101406, 0.058046283467817539, 0.048107057855329746, 0.037767927101913484, 0.060318656903537854, 0.058183134967851519, 0.033516313001885213, 0.04073770612087102, 0.052202893636469794, 0.050220801105933188, 0.042752923268881401, 0.049678881184595916, 0.031583185003275463, 0.039423888888274056, 0.030067243507379902, 0.055081888505195235, 0.03177016313825172, 0.070528768031539901, 0.054265386386271326, 0.038165341258563849, 0.03580192177960298, 0.039364301273607433, 0.034237545055416277, 0.032528803207877398, 0.048922112280970764, 0.04617381465934102, 0.033222191699459461, 0.054435200644840448, 0.06136828896867684, 0.059992991574138316, 0.052666922221025071, 0.048210145497992643, 0.049436005666425309, 0.056963746319929315, 0.040851390461636237, 0.062572720919220115, 0.031726033652647249, 0.086575002066763787, 0.040575699237345102, 0.078219031386454224, 0.050098705107120819, 0.045567604729924799, 0.040922330396335777, 0.03400337325656571, 0.055148207872385085, 0.039010729036166147, 0.049183155713042243, 0.038451463948082576, 0.048265699737219454, 0.061308328933815881, 0.08649421724019829, 0.047235033389470736, 0.033719264818610498, 0.033302512814551419, 0.047559492504446299, 0.038351044296794506, 0.028629952889903776, 0.039502670662311591, 0.029222459100824903, 0.043718709144470624, 0.030971456259341987, 0.027925709056208677, 0.028091218353428947, 0.061068161075547314, 0.03573565120811753, 0.058775672855781329, 0.037931897195832474, 0.043723785231155915, 0.031455390340519244, 0.065755368221144278, 0.06136828896867684, 0.058867115187142285, 0.044561342241359943, 0.10279032160720492, 0.058067472538813114, 0.061801196028193048, 0.037524955768483623, 0.031558263117852856, 0.035438843940035936, 0.035708514059840199, 0.051352108005435215, 0.046282692205191531, 0.062424330066513906, 0.058493244298419123, 0.056735155646541857, 0.046612718859050259, 0.051331163241949994, 0.044399022479367459, 0.05005972306572605, 0.047087381593055921, 0.036419704546003864, 0.052653916864822056, 0.03924011726089438, 0.031873265755099842, 0.038914051783862084, 0.033524897520610886, 0.033286702467658649, 0.038975093208024211, 0.060231913602263487, 0.034087988614557432, 0.065093494503116564, 0.045479179254933305, 0.035419988327908505, 0.044561342241359943, 0.042976044395471688, 0.061649995341756553, 0.043349073971702241, 0.036735554080439464, 0.037916307915905979, 0.080156452570409931, 0.026905885995261225, 0.05915938612534085, 0.037297917126763482, 0.069850270229506101, 0.05237729120986314, 0.046530895926600951, 0.066000698742484862, 0.030614379991230838, 0.050444134258831458, 0.041422192203685169, 0.054235024500167428, 0.032731539533546204, 0.036357386156670599, 0.03847864265640346, 0.03203737464353508, 0.049096760928322172, 0.039785480494918278, 0.032617538289624652, 0.045924704356316327, 0.050163527256524849, 0.050328774266888116, 0.054597868971270322, 0.054247531317468477, 0.032076895991743848, 0.028914698537079286, 0.054451955231415487, 0.048025177157150128, 0.060828275613198361, 0.060187819728564407, 0.027862739939912236, 0.047738524852505612, 0.034835065457867451, 0.058063271632570704, 0.067220359332978402, 0.0586172321726805, 0.031958291420154758, 0.052202893636469794, 0.033963539754386769, 0.040676657883071669, 0.053111727394226212, 0.044809670799632786, 0.034597335318052022, 0.066467173286820003, 0.039898799680459757, 0.033991069876676626, 0.029539526007672616, 0.062002216344819283, 0.043180335239285272, 0.028365688480361174, 0.039481785909376135, 0.04920626861378527, 0.033065879821789587, 0.048589559291997389, 0.055526761768619391, 0.047431474557838027, 0.048534300006091213, 0.029538824435662484, 0.036282283681025804, 0.051037816730950064, 0.077790565876224765, 0.045443216263025631, 0.042644224684732793, 0.030794140325622575, 0.02926895829934166, 0.043541987523310455, 0.041521612596716342, 0.04092902226883819, 0.050823985413814388, 0.046957394259199509, 0.039411803380446947, 0.17392348298633825, 0.03601691105739447, 0.060309574602046057, 0.048540752080030565, 0.054286176571482797, 0.033394209280765641, 0.064248874766846625, 0.04070745186933368, 0.042344237873687435, 0.068987236767997367, 0.029222459100824903, 0.05113513868959628, 0.034459926333037884, 0.031177491830782649, 0.038136783909692232, 0.051125251051956137, 0.052958962342425323, 0.053213806222442268, 0.040202303903638395, 0.035369118746489042, 0.062160452663696839, 0.040682038088773312, 0.049552437595256169, 0.044055202016924234, 0.032003330231430933, 0.060678396385493924, 0.031229395539910852, 0.039517049141142326, 0.0405697922401973, 0.032027224140679766, 0.031156113694212284, 0.03924011726089438, 0.043796814534718578, 0.03659516413392605, 0.027994268934747199, 0.041509281353496602, 0.038814851397612801, 0.03081154845083485, 0.041939467074614961, 0.034586695074017078, 0.055885549896524646, 0.04677904170752159, 0.033733240680404092, 0.042392367629666319, 0.036439156903991257, 0.031213793259868998, 0.054080061475918012, 0.056274021813088562, 0.042490202769609728, 0.0683741476142746, 0.062345464609589132, 0.12838671196606333, 0.057889113850372334, 0.059274785657689517, 0.06824760075217276, 0.045176837129061578, 0.040179504786448501, 0.041618126413166909, 0.058428676799103386, 0.049690800276609416, 0.030159360780952209, 0.052410276248764709, 0.032558847310672524, 0.038378984306876321, 0.076445500986337594, 0.042976578566101514, 0.035925139802096502, 0.033742754899750815, 0.053764265820725875, 0.028030252552577808, 0.045430615079233898, 0.049181121708700037, 0.027008368134165111, 0.030210059217402406, 0.043938663842246178, 0.039077747700798637, 0.048532816797528425, 0.038199304070113627, 0.041826150099667364, 0.041601576753092451, 0.031145937528458331, 0.042570860796886476, 0.041512313981352675, 0.047063097266809517, 0.0366018330681529, 0.044372695688731117, 0.023130920636983986, 0.041843291354281359, 0.084919385783189236, 0.028378801619708745, 0.028218232816298577, 0.037242495955779983, 0.039625831500877048, 0.039618475110762108, 0.048336881129258678, 0.036420956929178717, 0.037812837450847681, 0.039950137133940682, 0.054378311361835199, 0.045280832373299204, 0.089742419410576216, 0.035481475638242888, 0.038306723724974109, 0.035558710780003271, 0.039778146723039309, 0.03990565027514012, 0.04692237264846455, 0.039072327284711245, 0.029847114076073204, 0.032008039189922344, 0.053214529567291544, 0.048503616348899811, 0.045336802535068749, 0.043180335239285272, 0.040236630945490709, 0.029824395980758339, 0.033750584857756769, 0.044527414924181719, 0.045540386335710711, 0.047538127852185086, 0.040099337877039662, 0.056092491120050422, 0.060531105452117186, 0.062252733578004288, 0.033710346534518973, 0.06547833251798299, 0.044792072059148327, 0.037236221767975024, 0.029014402520233303, 0.04875862702364657, 0.030681220802522439, 0.049343621705867827, 0.045804743738867656, 0.037327840559269007, 0.16687310099726463, 0.0350836348269353, 0.036396296532517858, 0.063030564336683248, 0.035481475638242888, 0.049232314480771366, 0.065051843415723662, 0.029073834283720248, 0.053705472209318914, 0.03841510759130129, 0.03572800761682228, 0.051572205140924518, 0.043024123980417779, 0.063789940819974786, 0.030625137675804256, 0.030074743158537278, 0.028031929881072892, 0.045564939735384349, 0.0429329078384992, 0.032595771689793038, 0.02645211696911497, 0.02843268015902849, 0.077739328223480106, 0.058096340155589475, 0.050217351284577737, 0.040180915384165773, 0.03543376087147334, 0.039588474241569874, 0.043104770240235339, 0.038975093208024211, 0.042001113286915963, 0.049036147467912149, 0.064319566874114512, 0.045878806747397104, 0.034476903248869414, 0.05036721241738655, 0.031109265608729907, 0.040931121130450901, 0.036769131641186253, 0.075903835309072951, 0.085530898200847222, 0.034661584515395735, 0.049786342246290125, 0.056954863112122889, 0.028520461204903702, 0.034524803725895628, 0.057120008368457278, 0.044793156961667649, 0.027183785421515366, 0.038618092423676552, 0.035730219752376155, 0.14050150587965321, 0.056735155646541857, 0.042457902767885553, 0.052909957353669053, 0.03871642392968494, 0.038292171795040693, 0.05630752920205484, 0.035033077219350117, 0.049839244519268855, 0.14357350535952357, 0.048991414324533474, 0.046366786529866366, 0.048288662298348765, 0.031585392892345847, 0.040377620099589326, 0.060234080332288373, 0.037758590736432715, 0.034166553112199571, 0.037649295234914365, 0.035229642732866731, 0.031008751578238253, 0.030748731188755048, 0.057888971400282901, 0.038331723809762595, 0.077595190982391038, 0.030584851177246786, 0.035135330106645511, 0.040353989523589678, 0.037197949103560508, 0.03588397993730319, 0.046799141176595171, 0.029931157080285927, 0.059508951362941542, 0.033168987345212925, 0.038530826861270559, 0.051038256115479762, 0.039355750515753421, 0.063030564336683248, 0.040586179231599157, 0.068643212724491032, 0.033858758918841637, 0.040294013107022603, 0.044835750173316563, 0.049846322547362334, 0.039826014447114241, 0.044767340273437164, 0.049466309316490015, 0.058571358353291442, 0.047556086945185483, 0.041668580611024762, 0.047356853418905616, 0.044284727774149379, 0.055122846080867774, 0.054172086294883778, 0.039324326616333401, 0.060755589512196527, 0.057603166679697559, 0.075405236486999705, 0.037312180522494479, 0.035487741860101354, 0.041441437608432566, 0.045300783626309397, 0.046371227398113959, 0.067561895756523285, 0.062525424383980566, 0.041704644132075766, 0.053857593929502262, 0.064234454648062017, 0.03854738695087797, 0.21126844896799121, 0.03847864265640346, 0.033353195954046573, 0.031649796690671056, 0.0463108854007548, 0.060233351568763582, 0.041352055298923066, 0.035157039575658591, 0.036323317615997594, 0.04331991062959583, 0.044957740792302532, 0.041909484445248918, 0.034551237847564725, 0.094031054328730421, 0.039233182764181466, 0.058132754713679347, 0.063963141228315951, 0.036967304303748366, 0.055604006421516659, 0.038750882526564355, 0.036189681242602523, 0.059104733789326659, 0.029851134819200729, 0.056573793138258333, 0.05777063022841783, 0.041426467629657682, 0.067598418025335061, 0.034483673875483789, 0.058661254943453048, 0.046314276288645054, 0.032573742324003424, 0.04963044239911063, 0.038589503853589502, 0.039099985072707705, 0.065792489459087694, 0.055769164729811471]\n"
     ]
    }
   ],
   "source": [
    "y_pred = test_predict(data_test, coef)\n",
    "print(y_pred)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.0430433853080912, 0.027962641959843815, 0.060479486152498006, 0.019431419716201777, 0.022674016403607347, 0.07617130857365903, 0.042807655227836125, 0.05046695238576308, 0.06812844042259575, 0.06594320808258869, 0.04571444420296451, 0.05786812219068246, 0.04479497830415948, 0.07894011708178932, 0.047675010689764354, 0.0619548138129868, 0.057768851694845094, 0.08789813309476784, 0.04499429893843479, 0.05303699643342404, 0.05060177498774814, 0.02207111724063403, 0.0343249631952334, 0.029038132351423357, 0.034302032380470145, 0.03637150430451434, 0.06513439284647424, 0.04017036733067905, 0.04222823462070803, 0.04044496641189083, 0.04431329204749007, 0.021322425761744614, 0.05043749676638263, 0.052784954339487294, 0.03941106434082922, 0.04137553177428458, 0.035865884348005334, 0.05008054883550479, 0.02173036985404247, 0.029718984751528427, 0.053573355659924625, 0.08973778066514383, 0.06325611060210598, 0.035461435234930776, 0.07939358141914474, 0.04366818883233077, 0.05198170428368488, 0.025640656688959474, 0.05786813817431471, 0.03859722095478829, 0.05186828762142123, 0.05141956978625015, 0.05882560980803175, 0.030872258594745346, 0.05862640488025136, 0.04223554504766209, 0.05633417272595321, 0.046782635812026706, 0.03119012033199408, 0.04480606379975901, 0.05651416757802268, 0.061257825720549476, 0.05678986985828194, 0.022881574254667535, 0.0673736460042165, 0.043280429436257345, 0.033075307142759, 0.04779883825960549, 0.032950160148646046, 0.04803747127131428, 0.05953910983550758, 0.029920283336015888, 0.048575178814051524, 0.0644896251511576, 0.061036646938870516, 0.0728020504112397, 0.04610533601299027, 0.06164958086301785, 0.030645966498890984, 0.023347765319712912, 0.10744228764263465, 0.06092025375270848, 0.0333704181665048, 0.03341150534390941, 0.19796936065249598, 0.014720740354501008, 0.038578300978898965, 0.04019389617797967, 0.036177840371903885, 0.02359818126688045, 0.049770715705817564, 0.04352112254766557, 0.04729147402256417, 0.04470460043415568, 0.05730819469894492, 0.0360499585612992, 0.02448276410620156, 0.03377326078889408, 0.020401538582854192, 0.028159426741012124, 0.052501875442786554, 0.029827492109763206, 0.030832250527578195, 0.04223988749660277, 0.03983781752341834, 0.03362084788963111, 0.03439646147717359, 0.04921113981017162, 0.04953801857551706, 0.03769610634682757, 0.017654808304653793, 0.03535128084941425, 0.0636983887483635, 0.042417995249733394, 0.03662128215804947, 0.040294617903575206, 0.05733088028696864, 0.029156546642751063, 0.057193540072705086, 0.07990781373414853, 0.03682726558171524, 0.050655956531584403, 0.045044609978195295, 0.04235976749126355, 0.047223417026103, 0.05991795667465822, 0.05555995749386154, 0.05349360528141243, 0.028167324999937748, 0.04305899878168732, 0.03068911137655229, 0.06980601115723985, 0.04554958145149802, 0.02740797687786146, 0.043982792468145605, 0.028240254626141617, 0.04476751147295302, 0.07098178930088957, 0.2456047499187797, 0.06920712201867633, 0.04397350564866119, 0.09739738603426294, 0.026232523883166388, 0.04451924345664445, 0.059085984554714734, 0.036556239222271025, 0.03395291094078717, 0.07744270445859075, 0.06193987659489094, 0.05656646955861711, 0.056826712973460265, 0.01482675812262962, 0.03333585553957305, 0.0721024095510193, 0.04169494213435769, 0.06092025375270848, 0.07643766275624117, 0.05245446232032712, 0.07308306834052108, 0.04960737741431851, 0.028240867155584607, 0.04706168701061477, 0.023770128810638013, 0.02258461589498261, 0.033625702172422674, 0.028187045077438033, 0.05237972634834837, 0.035714891652041454, 0.08296126002174954, 0.02595359800076725, 0.04606444125009063, 0.040668683842920876, 0.027830506866694502, 0.027087199140797574, 0.06381650444796431, 0.03259049259899528, 0.035577440458070306, 0.024551277696541227, 0.08182431212403278, 0.055661821109796165, 0.06056468046882125, 0.05702690287824576, 0.0475977356523552, 0.060308117678157705, 0.023195900855801102, 0.031806449130721594, 0.049923481063063435, 0.06627325959922768, 0.05739603531220709, 0.02551043930022598, 0.048521685113504374, 0.02689081171347554, 0.04581655250005856, 0.0373554017993414, 0.05699125428710191, 0.05091489691761602, 0.03762869757334625, 0.0354330801165503, 0.032612200105910615, 0.038517208507290145, 0.09344682472902553, 0.06431645609469215, 0.08136214503705486, 0.02687882883243599, 0.11513935627103278, 0.07592167513050949, 0.04878098186699139, 0.02321188703583726, 0.11895290428364806, 0.042713354333399504, 0.04731813174318685, 0.034839947280790214, 0.045339607730378595, 0.052193136457581744, 0.04341150653859322, 0.03869037203512177, 0.036122747744729206, 0.05050952421193299, 0.03620672352230197, 0.028287253376972382, 0.022098066948431177, 0.044474984486038795, 0.0420927556404048, 0.01235705844136935, 0.04422581359523173, 0.038775339285844625, 0.0586823668240241, 0.06583967625198657, 0.04718817925104819, 0.0442508211973063, 0.04052688950330821, 0.043712059184987447, 0.02961737127681403, 0.028286875519454052, 0.0428238692643674, 0.047926227607749644, 0.06822604353651242, 0.044532185761408306, 0.026195754457788788, 0.03264946806013829, 0.06620350398160167, 0.040622638325738786, 0.04640731004311885, 0.053353825986508126, 0.02117130143679728, 0.04668649599810223, 0.05493087778578881, 0.03606825268101459, 0.035523927914368064, 0.05729891350771664, 0.06828928550935907, 0.06936956975227464, 0.08482773870949316, 0.028579002319839123, 0.038090467273220345, 0.03095369558730586, 0.03381400549861855, 0.03833152356245925, 0.0629996678836692, 0.02834544448551673, 0.026680052450256647, 0.03231321667196767, 0.031286819060896434, 0.039009330617219624, 0.05374234548330363, 0.03244806298201892, 0.02405866584391807, 0.0468330985694661, 0.057795396437209295, 0.08414991643265163, 0.04324355616499956, 0.03294906848170269, 0.039391816020329574, 0.049046664532521426, 0.059249791888609626, 0.039051055996633076, 0.029827492109763206, 0.03004707253516709, 0.055781532182765575, 0.06639652141429932, 0.025809352922682226, 0.03735641358159246, 0.060134733559426896, 0.037183979147529515, 0.04650473526230767, 0.03296050298391703, 0.03346848166745163, 0.03886595356186543, 0.06161445896764644, 0.021557862769127613, 0.04855878415950888, 0.06471972027712752, 0.06470910892397297, 0.02848891542085223, 0.06512748161133933, 0.05095330204152432, 0.046129990059354024, 0.05914500618548131, 0.036704009334105746, 0.05905481923486194, 0.03235937072536408, 0.02650864427073215, 0.03177963370053866, 0.035926673435846115, 0.026924536605995725, 0.035865884348005334, 0.035510944559856365, 0.06594320808258869, 0.05035401166625502, 0.09696444920517792, 0.03232865672614179, 0.04118293377617823, 0.07500171407002847, 0.043280429436257345, 0.08116908204937609, 0.027505685252798, 0.09571893829884356, 0.02972976334674922, 0.023149002321958, 0.03245648512741608, 0.02189022415552974, 0.036352885363132484, 0.04553952346207734, 0.02852839856122757, 0.057472015792563995, 0.06023383364937664, 0.059306989540820546, 0.03765613643434046, 0.06733018918609825, 0.06939091703032234, 0.041810511023860165, 0.04312696309356685, 0.08166006877536483, 0.026020937493233955, 0.03926717424440286, 0.04750955783486002, 0.0767784984030639, 0.051686836157618384, 0.02882695844858478, 0.06807946503718822, 0.022708469737301784, 0.03719296800720519, 0.04147574918577121, 0.018532214323138365, 0.03032910819707356, 0.05320108172935693, 0.051258513289938676, 0.04481716095136507, 0.0553309219762979, 0.06615708112220589, 0.08524359829006768, 0.023853838191806875, 0.029990603012303576, 0.049230407248510764, 0.0532834423826059, 0.048944075349088206, 0.045274628955360705, 0.026940639332937173, 0.050414024165259586, 0.044123226973504084, 0.059779047644010326, 0.05043749676638263, 0.029027450702754046, 0.03862321230613187, 0.04397350564866119, 0.06374277196913318, 0.05911338632080313, 0.03362086000738566, 0.0442288765365948, 0.07097464359545594, 0.076451560929399, 0.032644338784207944, 0.06070189782432897, 0.030028446847562156, 0.041387363480328676, 0.05370613739821217, 0.03287094367468152, 0.04578850880036142, 0.020497648300502117, 0.03492558940318512, 0.03206813877415891, 0.05615807039622619, 0.05532485665176719, 0.04748533220724821, 0.040716132011179615, 0.033036412796141584, 0.01998063638077711, 0.040721008822122304, 0.026836669523809253, 0.04042279183878851, 0.05901741644354427, 0.0451621703249188, 0.027215669067544374, 0.022463435578987754, 0.058353495231924075, 0.0523570258992943, 0.03436227656552086, 0.049770715705817564, 0.06576457542343284, 0.07211713593270769, 0.04937996405681384, 0.0305331546728835, 0.04377126406481687, 0.039196339744142314, 0.07995632807003625, 0.06791551609889708, 0.04323677445912063, 0.030556468192918962, 0.0524271362544958, 0.05206277931488631, 0.058382097542309316, 0.04647672654200539, 0.07223382790108755, 0.039545771631098924, 0.02740797687786146, 0.032659764817471, 0.07460089068966787, 0.03417630624967666, 0.03345896552286242, 0.048521685113504374, 0.04764592417599511, 0.08896199121818438, 0.04080687067001723, 0.07136397157735715, 0.05320108172935693, 0.01738019560883841, 0.045677184290355305, 0.025463079536198592, 0.025621443643639743, 0.0716271116172869, 0.05139196294733388, 0.05974836295534322, 0.041876908769870304, 0.04551669532901168, 0.037538827610031224, 0.0645235478389662, 0.056739862253868956, 0.031003201158559326, 0.03429289516884831, 0.032026805821516444, 0.05809616331540341, 0.040412387894814716, 0.053524363396343186, 0.03367229997752073, 0.06342856629142998, 0.026953528239249007, 0.050739855975865444, 0.04794438180264675, 0.04578170349557376, 0.02789198894077762, 0.07749364595030801, 0.05418730647424607, 0.053207853111833785, 0.03959081496973535, 0.02795499153417622, 0.03271259933215479, 0.030370124265409783, 0.029942741565643492, 0.0789876302627407, 0.04348930771529421, 0.046704528063614234, 0.05691165813918271, 0.023785286122223387, 0.056033855928461565, 0.0329631293350636, 0.051471060106679525, 0.0319813181505559, 0.0468521787890613, 0.025668852899996628, 0.04191495531163651, 0.029770697734934976, 0.04213562658971278, 0.0384603730029245, 0.038993944629929535, 0.09347276305980358, 0.03032844064065011, 0.04978360139068312, 0.06706394200373629, 0.04701304969091972, 0.0722173951155972, 0.024403053969431557, 0.034344817397770955, 0.07537681097676026, 0.00880015856758936, 0.03353924669690969, 0.053302270688580115, 0.04571444420296451, 0.05882574715727721, 0.05057125364877243, 0.03413128137392297, 0.03865831221651853, 0.057761216653672544, 0.11062183125404082, 0.0566995961515512, 0.047333410855770884, 0.036500331030471185, 0.04406099467393862, 0.029806161145831813, 0.04537984073177405, 0.03867723918450116, 0.04637392655846566, 0.019638209509946547, 0.036556556887875874, 0.02961554312452719, 0.028509779525038782, 0.03499524140312641, 0.024154968430019692, 0.03931553751971268, 0.03790072671327942, 0.05490894144362318, 0.025456964714330434, 0.06078873135845396, 0.04332935003033543, 0.040715962328508215, 0.06102422523215477, 0.05398512504543779, 0.02943599067328241, 0.04211666867512645, 0.053249012214798365, 0.04276079511341606, 0.037425781026115656, 0.04945740131721623, 0.030462045891834044, 0.037597035366617, 0.024645754148741893, 0.06593728762774981, 0.026219449072769307, 0.08289702625624365, 0.057351672551426126, 0.041047437098911024, 0.03265840773813108, 0.03679137976152694, 0.029866984425029858, 0.03279581728183999, 0.0635530451180173, 0.05121038872191823, 0.02686150188292184, 0.06673681334420549, 0.07118015421322264, 0.05656048626841837, 0.037524616408356935, 0.039844294133616294, 0.052210403157261005, 0.05940454994076857, 0.04580843521153056, 0.06939020833516929, 0.027101923579947753, 0.05099189460647578, 0.030965102772794552, 0.08314621767262055, 0.046256839277684335, 0.04563698623715466, 0.041218989990771816, 0.03685551412890307, 0.05342242087350881, 0.029456342050633615, 0.04951260088674821, 0.03457186583060089, 0.04644752477343649, 0.06092080420757005, 0.08042383177965308, 0.0559442886851267, 0.028815660271069608, 0.031215544970263687, 0.04659635831656527, 0.04163382659704742, 0.027851866126897454, 0.031140080223604913, 0.02745683221305238, 0.04196564986069993, 0.025024030977965978, 0.022602826251453417, 0.027205318366114686, 0.04434094757944804, 0.038154415688402464, 0.058637818869501784, 0.03314867006099513, 0.04392224382528793, 0.025996148531901825, 0.06617261662053198, 0.07118015421322264, 0.06281252587682426, 0.05060177498774814, 0.08669144466563547, 0.0684453493111933, 0.07409829646610341, 0.030116844259592657, 0.027908251101947706, 0.03676696450157063, 0.03563686528424399, 0.06471972027712752, 0.05875181278540507, 0.06207205594085141, 0.06702427778717909, 0.06193987659489094, 0.039878949043024955, 0.054788912570453784, 0.04971768926454118, 0.04914684731454203, 0.053221525698809946, 0.03589920324354843, 0.07335372789039017, 0.043842924156747294, 0.02698989882696949, 0.04803747127131428, 0.029606394805314896, 0.02773654038992823, 0.04808796276200802, 0.06967228217856121, 0.03831299289755637, 0.06360313849503421, 0.026686734540168244, 0.03100826461608591, 0.05060177498774814, 0.047228557792794, 0.06188017787917653, 0.061231250806926554, 0.037249768178865134, 0.029268942748376745, 0.0796363045872638, 0.020074250011273363, 0.05843465860372221, 0.030639776616434067, 0.08129688274603529, 0.057924046683870814, 0.05110606383119705, 0.059362821898675054, 0.031146783969905296, 0.05218600789120929, 0.04012002908946447, 0.05735961259687357, 0.026850343171376724, 0.030825855059309352, 0.050414024165259586, 0.025226080349574336, 0.05314484113068626, 0.036521988890271494, 0.025915025063330894, 0.04252326400231187, 0.05303537545719837, 0.044242084302153824, 0.05423350261860057, 0.0564228430064496, 0.02551043930022598, 0.02745536471502545, 0.06106012149390438, 0.03490571060180873, 0.05419374737501029, 0.07215726854103205, 0.022451480697666667, 0.04355147089010233, 0.030906520151773927, 0.07410550481084037, 0.06975314519021818, 0.06432610506948407, 0.026134749168566833, 0.053249012214798365, 0.03288277052330152, 0.04567234332640081, 0.05981528085767601, 0.03721146706228749, 0.030071794383276163, 0.06312967930089385, 0.03863145866766609, 0.026672962676633095, 0.02445113596882721, 0.06166628343729588, 0.04219781493925849, 0.026281949677989986, 0.038377741225358454, 0.05578656863379029, 0.03271854276553502, 0.05656646955861711, 0.07861131433682833, 0.04376966897438168, 0.05834606484266826, 0.024592938631845272, 0.036158633750284816, 0.06036507929751402, 0.056064076150350015, 0.04556267610660774, 0.03662922773810889, 0.02583249096346615, 0.022172789172835786, 0.03009591368157654, 0.046821163597214714, 0.04568626092155512, 0.05437705251640015, 0.05014618508704522, 0.03250949653335185, 0.17407411767041267, 0.02826309544036413, 0.057355769803441495, 0.053246568564491684, 0.04813885112667911, 0.02688969955642365, 0.07491779798352317, 0.04364226098623467, 0.04732541956992862, 0.07186066261271862, 0.02745683221305238, 0.05896061505529524, 0.029934875159218992, 0.0268986764975247, 0.03268686652502423, 0.04876048529738953, 0.04733813089491545, 0.055174355130469734, 0.03552183660257924, 0.030360231521178185, 0.05768820612887462, 0.04372616924928922, 0.05444296154848977, 0.050106118391954994, 0.025410064895459192, 0.06407969775752403, 0.02411270281788459, 0.03587998745810053, 0.04485817462439077, 0.02423027101011676, 0.026101104959527426, 0.043842924156747294, 0.03788111323687659, 0.04048170968861727, 0.020892868802202997, 0.03890502539939243, 0.038818713471545196, 0.031112064465494336, 0.04373510964502418, 0.031169462481944535, 0.04364806418155549, 0.04749379606114836, 0.03258693598196789, 0.04054785779436936, 0.03527728494769812, 0.025103411425827473, 0.05193306287638154, 0.05760127416751089, 0.038370489356355224, 0.07962149802312135, 0.0593931729378726, 0.14571594130473295, 0.06316132040998783, 0.06300204229434722, 0.05963404106586303, 0.050844444900629976, 0.04425724103380128, 0.036785414849865694, 0.058288384510963506, 0.05347896530619433, 0.02258461589498261, 0.05160805763564105, 0.02609862682289446, 0.03828553804094191, 0.055351328252592195, 0.04169185637334948, 0.036556239222271025, 0.02276313209998678, 0.06506324519172325, 0.025988540101875044, 0.042723626894498344, 0.0443049651186635, 0.02372435631449594, 0.030796643240732544, 0.05423942899660219, 0.034940303755404724, 0.05775604388658196, 0.034071814450594186, 0.037732817289293265, 0.04011045267872729, 0.024285720058544385, 0.04479043854759951, 0.05056316195147014, 0.05018443047956693, 0.03595856268001566, 0.051238860087295716, 0.01598868931171064, 0.049393633674739826, 0.08442026974680628, 0.02223022464470344, 0.023055014612505146, 0.03306955622058869, 0.04199901234759722, 0.05101494076781325, 0.04854590070520538, 0.03197638044060728, 0.03408402732110762, 0.04081924639180194, 0.04999520608291082, 0.0320260442431568, 0.09624254427634958, 0.0374813155762564, 0.036880877427727596, 0.030888740616022883, 0.04380354406800333, 0.03908676972476454, 0.054272153137804986, 0.042831961186322653, 0.02387754472660414, 0.026208577803478152, 0.056566718444867256, 0.048521685113504374, 0.048575178814051524, 0.04219781493925849, 0.04022088073392577, 0.02950372831001583, 0.03277340479298383, 0.04443388002544503, 0.03873320532246474, 0.04714314735986843, 0.03735622454545096, 0.06306939992390928, 0.06458584389361892, 0.07975830048271207, 0.025646593340473884, 0.06797515297196786, 0.05271968017525635, 0.03399166895998824, 0.027764365529345057, 0.04531822811565948, 0.030316387576507394, 0.059306989540820546, 0.06171787993134051, 0.04128353778522765, 0.12006528646897528, 0.03050548467644631, 0.02794585684816195, 0.07556581505772603, 0.0374813155762564, 0.05708636171954159, 0.06549062686106422, 0.0343249631952334, 0.05163656560536468, 0.036167007636431193, 0.030555552356986544, 0.04703014038913871, 0.03510778939448713, 0.05681975729607382, 0.024910615324078608, 0.019661678291084915, 0.0223330428192678, 0.05258262439176721, 0.041564263070632025, 0.030181041346797687, 0.026114725697374098, 0.020946480614466426, 0.09959894727631122, 0.062114647268383893, 0.06400707851857702, 0.03305906847233631, 0.03586243432383181, 0.048442095953703274, 0.05697203463918792, 0.04808796276200802, 0.044922703400638496, 0.05134799201579995, 0.07706915940613329, 0.046714140729746514, 0.033541913011487186, 0.04658509185859988, 0.032241647957734945, 0.04724464161304507, 0.030066154311244507, 0.08287163014975502, 0.057440997542752344, 0.030748286618543473, 0.05296545455741338, 0.057762680897481884, 0.027788642629526055, 0.03384476898438394, 0.05908649601471509, 0.03645719725246226, 0.022716017826331533, 0.03697695462828841, 0.0325539542724643, 0.08217236933470357, 0.06193987659489094, 0.04920817673582489, 0.05953057731770094, 0.03543370577968017, 0.03776899544266455, 0.0501914347862037, 0.027458181645074277, 0.05959515134399229, 0.1062366073696645, 0.04095807085898847, 0.046707848413595154, 0.05982837958516893, 0.029942741565643492, 0.038014850654142424, 0.06826854076450212, 0.033590569063528225, 0.023495701854421958, 0.03238441413075622, 0.029537126795248655, 0.022374966919037797, 0.03022952156888966, 0.06929946653746988, 0.04005792716393994, 0.08765464332481375, 0.030317478926961468, 0.029324715491883428, 0.04282277909970633, 0.03631535117018099, 0.03554394662379814, 0.0436226258637683, 0.014622030905146995, 0.06727428830019033, 0.027705971096421027, 0.03157209652716526, 0.05526407681475986, 0.043036656766479976, 0.07556581505772603, 0.040349752628156044, 0.06095922674010211, 0.02645019764904789, 0.049745820693269556, 0.03733461102078924, 0.044075077729986305, 0.037289072032751835, 0.036469718013972995, 0.05528469362190013, 0.07135970706016437, 0.05142091010530425, 0.04069521514109425, 0.0519083211662505, 0.05029499415104555, 0.03861247720555796, 0.048757324035792464, 0.03783804478933968, 0.06518843554532236, 0.06518183258310065, 0.07964713236650524, 0.0369813529924012, 0.04400446600365716, 0.04849432779890997, 0.036164700473806724, 0.040850089764011534, 0.06597509136855503, 0.058407922146323114, 0.04422581359523173, 0.06263222244267733, 0.05874695722615993, 0.0374002624594174, 0.2456047499187797, 0.050414024165259586, 0.03264582985124789, 0.030331069260659108, 0.05398194536425609, 0.057229035807681176, 0.040812440247600834, 0.030633817741929945, 0.026360632122859506, 0.04154895606349931, 0.052008767926289376, 0.04707584678113797, 0.03264946806013829, 0.07530473369078089, 0.042460973893440425, 0.0615008451366898, 0.06089055239704849, 0.03341861814298974, 0.06027995520618543, 0.034479483138685194, 0.034633332424912885, 0.06521281863714161, 0.022577226654768575, 0.06499265494106224, 0.06505970971456405, 0.04213014932445735, 0.08095458649517394, 0.03201900376899921, 0.05308508029195612, 0.043849509277344295, 0.027874577413266363, 0.05224480338101783, 0.04472505817397964, 0.03884355584669818, 0.06208204366099263, 0.05821454808848156]\n"
     ]
    }
   ],
   "source": [
    "print(data_test[:,-1].tolist())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.0076665329240807635\n"
     ]
    }
   ],
   "source": [
    "print(rmse_metric(data_test[:,-1], y_pred))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
